Xbasic

API_UUIDCREATE Function

Syntax

Unique_Hex_String as C = api_uuidcreate()

Arguments

Unique_Hex_String

A 32 character (128 bit) hexadecimal string.

Description

Return a 128 bit globally/universally unique identifier (GUID/UUID)

Discussion

The API_UUIDCREATE() function returns a Universally Unique Identifier (UUID...otherwise known as a Globally unique ID or GUID). This is a 32 character (128 bit) hexadecimal string (not including dashes) that is guaranteed to be completely unique if you have a network card. If you do not have a network card, the number is only guaranteed to be unique to the computer. It calls the internal Win32 API function UuidCreate(). This function would be used any time you need a totally unique number such as a key value in a table.

Example

dim list as C
for i = 1 to 10

list = list + api_uuidcreate()
next i
? list
= bbd9de2d-47e6-44f8-ae5b-8238e7d31b55
0caf734e-7d22-4cd3-8e4f-e68489f41919
20b93a4b-09ef-4a43-9f73-f3e93c5cebe2
e04fb858-116c-49f4-9a1e-328e32705975
6f35a20f-d769-4179-b8c8-930aae71cc4a
deb1298d-1b8d-4162-947a-bce3d59c8a17
6f93bc5d-c3fb-4969-a485-aea8d9a04005
ae245a20-372f-475e-a0db-932eeb0575a5
e32d4133-5b02-4c8f-8119-ee0dca584e76
db524e77-66e4-4905-908d-60e4fb7569a3

See Also